About GCP Workload Identity
To allow components to use the Google Cloud Platform Workload Identity to impersonate Google Cloud service accounts using short-term, limited-privilege credentials, you can configure your cluster to use manual mode with GCP Workload Identity.
Google Cloud Workload Identity authentication process
You should familiarize yourself with the Google Cloud Workload Identity authentication process.
Requests for new and refreshed credentials are automated by using an appropriately configured OpenID Connect (OIDC) identity provider combined with IAM service accounts. Service account tokens that are trusted by Google Cloud are signed by Red Hat OpenShift Container Platform and can be projected into a pod and used for authentication. Tokens are refreshed after one hour.
The following diagram details the authentication flow between Google Cloud and the Red Hat OpenShift Container Platform cluster when using Google Cloud Workload Identity.
Google Cloud component secret formats
To change the content of the Google Cloud credentials that are provided to individual Red Hat OpenShift Container Platform components, you can use manual mode with Google Cloud Workload Identity.
Compare the following secret content:
apiVersion: v1
kind: Secret
metadata:
namespace: <target_namespace>
name: <target_secret_name>
data:
service_account.json: <service_account>
where:
metadata.namespace-
Specifies the namespace for the component.
metadata.name-
Specifies the name of the component secret.
data.service_account.json-
Specifies the Base64 encoded service account.
service_account.json file using long-term credentials{
"type": "service_account",
"project_id": "<project_id>",
"private_key_id": "<private_key_id>",
"private_key": "<private_key>",
"client_email": "<client_email_address>",
"client_id": "<client_id>",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/<client_email_address>"
}
where:
type-
Specifies the credential type, in this example the type is
service_account. private_key-
Specifies the private RSA key that is used to authenticate to Google Cloud. This key must be kept secure and is not rotated.
service_account.json file using Google Cloud Workload Identity{
"type": "external_account",
"audience": "//iam.googleapis.com/projects/123456789/locations/global/workloadIdentityPools/test-pool/providers/test-provider",
"subject_token_type": "urn:ietf:params:oauth:token-type:jwt",
"token_url": "https://sts.googleapis.com/v1/token",
"service_account_impersonation_url": "https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/<client_email_address>:generateAccessToken",
"credential_source": {
"file": "<path_to_token>",
"format": {
"type": "text"
}
}
}
where:
type-
Specifies the credential type, in this example the type is
external_account. audience-
Specifies the target audience is the Google Cloud Workload Identity provider.
service_account_impersonation_url-
Specifies the resource URL of the service account that can be impersonated with these credentials.
credential_source.file-
Specifies the path to the service account token inside the pod. By convention, this is
/var/run/secrets/openshift/serviceaccount/tokenfor Red Hat OpenShift Container Platform components.
Google Cloud component secret permissions requirements
Red Hat OpenShift Container Platform components require the following permissions. These values are in the CredentialsRequest custom resource (CR) for each component.
|
|
These permissions apply to all resources. Unless specified, there are no request conditions on these permissions. |
| Component | Custom resource | Required permissions for services |
|---|---|---|
Cloud Controller Manager Operator |
|
Compute Engine
|
Cloud Credential Operator |
|
Identity and Access Management (IAM)
Resource Manager
Service Usage
|
Cluster Image Registry Operator |
|
Cloud Storage
Resource Manager
|
Cluster Ingress Operator |
|
Cloud DNS
|
Cluster Network Operator |
|
Compute Engine
|
Cluster Storage Operator |
|
Compute Engine
This component also requires the following Google Cloud predefined roles:
|
Machine API Operator |
|
Compute Engine
Identity and Access Management (IAM)
Resource Manager
Service Usage
|
OLM-managed Operator support for authentication with GCP Workload Identity
To allow certain Operators that are managed by the Operator Lifecycle Manager (OLM) on Google Cloud clusters to authenticate with limited-privilege, short-term credentials that are managed outside the cluster, you can use manual mode with GCP Workload Identity.
To determine if an Operator supports authentication with GCP Workload Identity, see the Operator description in the software catalog.